package com.demo.accessibility.ui

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.AppUtils
import com.demo.accessibility.R
import com.demo.accessibility.floatwindows.GatherWechatInfoFloatWindowManager
import com.demo.accessibility.floatwindows.GatherYistationFloatWindowManager
import com.demo.accessibility.utils.AccessibilityUtils

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        findViewById<View>(R.id.btn_permission).setOnClickListener {

            startActivity(Intent(this, PermissionGuideActivity::class.java))
        }

        findViewById<View>(R.id.btn_go_gather).setOnClickListener {
            // 检测权限
            if (PermissionGuideActivity.checkAllMustPermission(this)) {
                GatherWechatInfoFloatWindowManager.instance.show(applicationContext)
                AccessibilityUtils.goHome(this)
                AppUtils.launchApp("com.tencent.mm")
            } else {
                PermissionGuideActivity.start(this)
            }
        }

        findViewById<View>(R.id.btn_go_gather_yistation).setOnClickListener {
            // 检测权限
            if (PermissionGuideActivity.checkAllMustPermission(this)) {
                GatherYistationFloatWindowManager.instance.show(applicationContext)
                AccessibilityUtils.goHome(this)
                AppUtils.launchApp("cn.com.yto56.yistation")
            } else {
                PermissionGuideActivity.start(this)
            }
        }

        findViewById<View>(R.id.btn_go_weideng).setOnClickListener {
            startActivity(Intent(this@MainActivity, SvgaTaillightDemo::class.java))
        }
    }
}